﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Collections.ObjectModel;

namespace SilveR.GUIValidators
{
    public static class BasicGUIValidator
    {
        public static ValidationResult CheckStringVarSet(string variable, ValidationContext context)
        {
            if (String.IsNullOrEmpty(variable))
                return new ValidationResult(context.DisplayName + " is a required variable");
            else
                return ValidationResult.Success;
        }

        public static ValidationResult CheckListVarSet(ObservableCollection<ColumnInfo> columnList, ValidationContext context)
        {
            if (columnList.Count == 0)
                return new ValidationResult(context.DisplayName + " is a required variable");
            else
                return ValidationResult.Success;
        }
    }
}